import React, { Component } from 'react'
import { Breadcrumb, Card } from 'antd'
import { Link } from 'react-router'

class CustomTitle extends Component {
  renderBread() {
    const { bread } = this.props
    const list = []
    for (var i in bread) {
      list.push(
        <Breadcrumb.Item key={i}>{bread[i]}</Breadcrumb.Item>
      )
    }
    return list.length > 0 ? (
      <Breadcrumb>
          { list }
      </Breadcrumb>
    ) : null
  }
  renderTitle() {
    const { title } = this.props
    return title ? <div className="base_title">{ title }</div> : null
  }
  renderTip() {
    const { tip } = this.props
    return tip ? <div className="base_tip">{ tip }</div> : null
  }
  render() {

    return (
      <Card bordered={false} className="base_header">
      { this.renderBread() }
      { this.renderTitle() }
      { this.renderTip() }
      </Card>
    )
  }
}

export default CustomTitle
